<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%-- <title>글보기 : ${requestScope.bvo.board_no }번글  </title> --%>
<style type="text/css">
    body{
        line-height:2em;        
        font-family:"맑은 고딕";
}
    ul, li{ 
        list-style:none;
        text-align:center;
        padding:0;
        margin:0;
}
textarea.textp { 
    font-family : "돋움";
    font-size : 9pt;
    color : #666666;
    resize : none;
    border : 1px #c9c9c9 solid;
    line-height: 15pt;
    scrollbar-face-color: #FFFFFF; 
    scrollbar-shadow-color: #C9C9C9; 
    scrollbar-highlight-color: #C9C9C9;
    scrollbar-3dlight-color: #FFFFFF; 
    scrollbar-darkshadow-color: #FFFFFF; 
    scrollbar-track-color: #FFFFFF;
    scrollbar-arrow-color: #666666
    
    ime-mode: active;
}


    #mainWrapper{
        width: 1000px;
        margin: 0 auto; /*가운데 정렬*/
   
    }

    #mainWrapper > ul > li:first-child {
        text-align: center;
        font-size:14pt;
        height:40px;
        vertical-align:middle;
        line-height:30px;
    
}
#ulTable	{margin-top:100px;      }
    

    #ulTable > li:first-child > ul > li{ 
        background-color:#191919;
        font-weight:bold;
        text-align:center;
        color:#FFFFFF;
        
}

    #ulTable > li > ul {
        clear:both;
        padding:0px auto;
        position:relative;
        min-width:40px;	
       
}
    #ulTable > li > ul > li { 
        float:left;
        font-size:10pt;
        border-bottom:1px solid silver;
        vertical-align:baseline;

}    
#content{
/* 	border:1px solid green; */
        position:relative;
        height: 40px;
}
#content li { 
	display:inline;
	float:left;
	text-align:center;
        font-size:10pt;
        border-bottom:1px solid silver;
        vertical-align:baseline;
    
}
#ulTabletwo	{margin-top:100px;      }
    

    #ulTabletwo > li:first-child > ul > li{ 
        background-color:#191919;
        font-weight:bold;
        text-align:center;
        color:#FFFFFF;
     
}

    #ulTabletwo > li > ul {
        clear:both;
        padding:0px auto;
        position:relative;
        min-width:40px;	
       
}
    #ulTabletwo > li > ul > li { 
        float:left;
        font-size:10pt;
        border-bottom:1px solid silver;
        vertical-align:baseline;
}
    #ulTable > li > ul > li:first-child               {width:10%;} /*No 열 크기*/
    #ulTable > li > ul > li:first-child +li           {width:45%;} /*제목 열 크기*/
    #ulTable > li > ul > li:first-child +li+li        {width:20%;} /*작성일 열 크기*/
    #ulTable > li > ul > li:first-child +li+li+li     {width:15%;} /*작성자 열 크기*/
    #ulTable > li > ul > li:first-child +li+li+li+li{width:10%;} /*조회수 열 크기*/
    
    #ulTabletwo > li > ul > li:first-child            		   {width:10%;} /*No 열 크기*/
    #ulTabletwo > li > ul > li:first-child +li    			{width:20%;} /*작성자 열 크기*/
    #ulTabletwo > li > ul > li:first-child +li+li           {width:50%;} /*제목 열 크기*/
    #ulTabletwo > li > ul > li:first-child +li+li+li        {width:17%;} /*작성일 열 크기*/
  


</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript"	>

$(document).ready(function(){

 $.ajax({
	type:"POST",
	url:"comentview.moja",
	data:"no="+${requestScope.bvo.board_no },
	success:function(jsonData){ 
		$.each(jsonData,function(index,ccvo){	
			//반복문 수행하면서 div resultView의 table 하위에 tr td 추가 
			
			$("#comentPass").append(
					"<ul id='content'>"+
					"<li style='width: 10%'>"+ccvo.coment_no+"</li><li style='width: 20%'>"+ccvo.member_id+"</li><li style='width: 50%'>"+ccvo.coment+"</li><li style='width: 17%'>"+ccvo.coment_date+"</li>"+"</ul>");								
		}); //each					
		//$("#comentPass").html("성공"+data);
	}   //success	
	}) ; //ajax
	$(":input[name=submitbutton]").click(function(){
		if($("#coment").val()==""){	
			alert("내용을 입력하세요!");
			return;
		}else if($(":input[name=member_id]").val()==""){
		 	alert("로그인하셔야가능합니다!");
		 return;
		}
	
	
	
		$("#comentPass").html("");
		$.ajax({
			type:"POST",
			url:"auth_coment.moja",
			data:$("#contentForm").serialize(),
			//data:"board_id="+board_no+"&member_id="+member_id+"&coment="+$("#coment11").val(),
			success:function(jsonData){ 
				$.each(jsonData,function(index,ccvo){	
					$("#comentPass").append(
							"<ul id='content'>"+
							"<li style='width: 10%'>"+ccvo.coment_no+"</li><li style='width: 20%'>"+ccvo.member_id+"</li><li style='width: 50%'>"+ccvo.coment+"</li><li style='width: 17%'>"+ccvo.coment_date+"</li>"+"</ul>");		
				}); //each					
				alert("등록되셨습니다");
			}   //success
		});//ajax
			});//click
/* 			$("#delImg").click(function(){
				var ref=$(":input[name=ref]").val();
				 var memberPoint=$(":input[name=memberPoint]").val();
				if(ref==-1 && memberPoint!=-1){
					alert("관리자만 삭제가능합니다");
		 }
	}); */
}); //click
	</script>
	
</head>
<body>


<%-- 			<tr>
				<td>
				<b>${requestScope.bvo.board_no }-${requestScope.bvo.board_title}</b>
				</td>
			</tr> --%>
			<div id="mainWrapper">  
			<ul id="ulTable">
			<li>
			<ul>
												<li>글쓴이: ${requestScope.bvo.member_id }</li>
												<li>제목: ${requestScope.bvo.board_title }</li> 
												<li>작성일:${requestScope.bvo.board_time}</li> 
												<li>조회수:${requestScope.bvo.viewcount}</li> 
			</ul>
			</li>
			</ul>
			 </div>
		
				<textarea cols="146" rows="10"  name="content" class="textp" readonly="readonly" >${requestScope.bvo.board_content }</textarea>
		
		<table class="content">
			<tr>
				<td valign="middle">
<%-- 				<a href="replyView.do?no=${requestScope.bvo.board_no}">
				<img src="${initParam.root}/img/answer_btn.jpg">
				</a>  --%>
				<a href="getboardlist.moja"><img src="${initParam.root}/img/list_btn.jpg">
				</a> 
				<c:choose>
	<c:when test="${sessionScope.mvo==null}">
		수정&삭제는 로그인 하신 후 사용 가능합니다.
	</c:when>
	
<c:otherwise>
				<a href="auth_update.moja?no=${requestScope.bvo.board_no }">	
				<img id="updateImg" src="${initParam.root}/img/modify_btn.jpg">
				</a>
				 <a href="auth_delete.moja?no=${requestScope.bvo.board_no }">
				<img id="delImg" src="${initParam.root}/img/delete_btn.jpg" >
				</a> 
				<%-- <input type="hidden" name="ref" value="${requestScope.bvo.ref}">
				<input type="hidden" name="memberPoint"  value="${sessionScope.mvo.memberPoint}"> --%>
				</c:otherwise>
				</c:choose>
				</td>
			</tr>
			<tr>
				<td>
				<span id="inputPass"></span>
				</td>
			</tr>
</table>	

<ul id="ulTabletwo">
			<li>
			<ul>
 <li>댓글번호</li>
  <li>작성자</li>
  <li>댓글</li>
  <li>작성일</li>
  </ul>
  </li>
    </ul>
 <form id="contentForm">

<span id ="comentPass"></span>

<table>    
			<tr>
				<td>
				작   성   자 : <input type="text" name="member_id" id="member_id" value="${sessionScope.mvo.memberId}" readonly="readonly" style="border: 0px;">
				</td>
			</tr>
	 		<tr>
				 <td>
				 게시물번호 : <input type="text" name="board_no" id="board_no" value="${requestScope.bvo.board_no }" readonly="readonly" style="border: 0px;">
				 </td>
		   </tr>
			<tr>
				<td colspan=2>
		 <textarea cols="32" rows="3" name="coment" id="coment" class="textp"></textarea>
		<input type="button" name="submitbutton" value="댓글달기"  />
				</td>
		  </tr>
</table> 
 </form>

</body>
</html>